package enum

import "errors"

// UserType 用户类型
type UserType string

func (n UserType) String() string {
	return string(n)
}

const (
	// assign 分配
	AssignUser UserType = "assignUser"
	// candidateuser 候选人
	CandidateUser UserType = "candidateUser"
	// candaiteRole 候选角色
	CandidateRole UserType = "candidateRole"
	// candidateGroup 候选组
	CandidateGroup UserType = "candidateGroup"

	UnknownUserType UserType = "unknown"
)

// GetNodeTypeByName 转换节点类型
func GetUserTypeByName(s string) (UserType, error) {
	switch s {
	case "assignUser":
		return AssignUser, nil
	case "candidateUser":
		return CandidateUser, nil
	case "candidateGroup":
		return CandidateGroup, nil
	case "candidateRole":
		return CandidateRole, nil
	}
	return UnknownUserType, errors.New(s + "不支持的类型")
}


type WorkOrderStatus string

const (
	UNCOMMIT		WorkOrderStatus		=	"UnCommit"
	RUNNING			WorkOrderStatus		=	"Running"
	CANCEL			WorkOrderStatus		=	"Cancel"
	FINISHED		WorkOrderStatus		=	"Finished"
	REJECT          WorkOrderStatus		=	"Reject"
	WOSUNKNOWN			WorkOrderStatus		=	"UnKnow"
)

func (c WorkOrderStatus) String() string {
	return string(c)
}

func GetWorkOrderStatus(s string) (WorkOrderStatus, error) {
	switch s {
	case "UnCommit":
		return UNCOMMIT, nil
	case "Running":
		return RUNNING, nil
	case "Cancel":
		return CANCEL, nil
	case "Finished":
		return FINISHED, nil
	case "Reject":
		return REJECT,nil

	}
	return WOSUNKNOWN, errors.New(s + "不支持的类型")
}